<?php

if(!empty($_POST))
{
	if(strcasecmp($_POST['vali'], $_SESSION['checkcode']) != 0)
	{
		echo 20000;
		die;
	}
	$username = $_POST['username'];
	$password = md5($_POST['password']);
	$re = selectone('admin',"username='{$username}' and password='{$password}'");
	//print_r($re);die;
	
	if(!empty($re))
	{
		if(!empty($_POST['remenber']))
		{
//			echo 1111;die;
			setcookie('username',$_POST['username']);
			setcookie('password',$_POST['password']);
		}
		else
		{
//			echo 2222;die;
			setcookie('username',null);
			setcookie('password',null);
		}
		$_SESSION['admin'] = $re;
		if($re['freeze']==0)
		{
			echo '此用户没有权限，请联系超级管理员！';
			header('Refresh:1;index.php?a=admin&b=login&c=index');
			die;
		}
		echo 20002;
		//header('Refresh:1;index.php?a=admin&b=welcome&c=index');
		die;
	}
	else 
	{
		echo 20001;
		//header('Refresh:1;index.php?a=admin&b=login&c=index');
		die;
	}
	
}




include('app/admin/login/html/index.html');
?>